<me:UIBSGROE x:Class="WPFExcelReport.TBSGROE"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                      xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIBSGROE.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIBSGROE.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"> 
            <WrapPanel   >
             <Grid Margin="10,0,0,0" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                              IsEnabled="{Binding IsCanNew,ElementName=TV}"
                              >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                    </Button.Background>
                </Button>
            </Grid>
            <Grid Margin="10,0,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button  Click="EditCommand" Width="24" Height="20"
                             IsEnabled="{Binding IsCanChg,ElementName=TV}"
                             >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                    </Button.Background>
                </Button>
            </Grid>
            <Grid Margin="10,0,0,0" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanDelete,ElementName=TV}"
                            >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button>
            </Grid>
            <Grid Margin="10,0,0,0" IsEnabled="{Binding IsCanCopy,ElementName=TV}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24"
                               IsEnabled="{Binding IsCanCopy,ElementName=TV}"
                               >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                    </Button.Background>
                </Button>
            </Grid>
            <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                    </Button.Background>
                </Button>
            </Grid>
            <WrapPanel>
                <TextBlock Text="{Binding Source={Localization:Translate Word=轴编号}}"/>
                <ex:TXT72 Text="{Binding ART,ElementName=TV}" Width="200" MaxLength="20"/>
                <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
            </WrapPanel>
        </WrapPanel>
            <me:TSB31
                KEY="{Binding ORDERNUM,ElementName=TV}"
                ORDERNUM="{Binding KEY,ElementName=TV}"
                IsEdit="{Binding IsEdit,ElementName=TV}"
                IsSaved="{Binding IsSaved,ElementName=TV}"
                />
        </StackPanel>
        <DataGrid   Grid.Row="1"   Grid.Column="0"   
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"   
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=BSGART}" Header="{Binding Source={Localization:Translate Word=轴编号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BSGMTYP}" Header="{Binding Source={Localization:Translate Word=织机类型}}"  Width="Auto" />
                 <DataGridTextColumn Binding="{Binding Path=BSGKETTART}" Header="{Binding Source={Localization:Translate Word=轴类型}}"  Width="Auto" />
              </DataGrid.Columns>
        </DataGrid> 
    </Grid> 
</me:UIBSGROE>

    
